#pragma once


#include <iostream>
#include <vector>
#include <unordered_set>
#include <sstream> 
#include "../cmdsql/cmdsql.h"



using std::string;
using std::vector;
using std::cout;
using std::endl;
using std::cin;
using std::unordered_set;
using std::istringstream;

extern const struct Cmdinit
{
    string splitchar;
    vector<string> cmdlist;
    Cmdinit()
    {
        this->splitchar = string(" ");
        this->cmdlist = {string("login"), string("logout"), string("ping")};
    }
} cmdinit;



class cmd :public cmdsql
{
public:
    cmd(){};
    cmd(string cmdline){};
    virtual ~cmd(){};
    virtual bool isvalid(){};
    void getcmdlineitems();
    vector<string> cmdlineitems;

private:
    

protected:
    static const string splitchar;
    static const vector<string>cmdlist;
    string cmdline;
};


class logincmd : public cmd 
{
public:
    logincmd(){};
    logincmd(string cmdline);
    ~logincmd(){};
    bool isvalid() override;
    void cmd2sql() override;

private:
    static const unordered_set<string> banedname;
};


class logoutcmd : public cmd  
{
public:
    logoutcmd(){};
    logoutcmd(string cmdline);
    ~logoutcmd(){};
    bool isvalid() override;
    void cmd2sql() override;
private:

};

